package com.ke.searchhouse.service;

import com.ke.searchhouse.dto.HouseBucketDTO;
import com.ke.searchhouse.dto.HouseDTO;
import com.ke.searchhouse.form.MapSearch;
import com.ke.searchhouse.form.RentSearch;
import com.ke.searchhouse.util.ServiceMultiResult;
import com.ke.searchhouse.util.ServiceResult;

import java.util.List;



/**
 * @author  keke
 * @create  2018/10/25 0025 下午 9:03
 * @desc 检索接口
 **/
public interface ISearchService {
    /**
     * 索引目标房源
     * @param houseId
     */
    void index(Long houseId);

    /**
     * 移除房源索引
     * @param houseId
     */
    void remove(Long houseId);

    /**
     * elasticsearch 房源搜索
     * @param rentSearch {@link RentSearch}
     * @return
     */
    ServiceMultiResult<Long> query(RentSearch rentSearch);

    /**
     * 关键词推荐补全
     * @param prefix 关键词前缀
     * @return
     */
    ServiceResult<List<String>> suggest(String prefix);


    ServiceResult<Long> aggregateDistrictHouse(String cityEnName, String regionEnName, String district);

    /**
     * 聚合城市接口
     * @param cityEnName 城市en名
     * @return
     */
    ServiceMultiResult<HouseBucketDTO> mapAggregate(String cityEnName);

    /**
     * 城市级别搜索
     * @param cityEnName
     * @param orderBy
     * @param orderDirection
     * @param start
     * @param size
     * @return
     */
    ServiceMultiResult<Long> mapQuery(String cityEnName, String orderBy, String orderDirection, int start, int size);

    /**
     * 精确查询
     * @param mapSearch
     * @return
     */
    ServiceMultiResult<Long> mapQuery(MapSearch mapSearch);
}
